﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace e2
{
    [Serializable]
    public class Good : Product
    {
        private int num;

        public int Num { get => num; set => num = value; }

        public Good()
        {

        }
        public Good(string name, double price, int num) : base(name, price)
        {
            Num = num;
        }
        public Good(Product product, int num)
        {
            this.Name = product.Name;
            this.Price = product.Price;
            this.Num = num;
        }
        public override string ToString()
        {
            return Name + "  单价: ￥" + Price + "，" +
                          "  数量: " + Num + "个，" +
                          "  总价: ￥" + Price * Num + "。\n";
        }

    }
}
